home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / sun / volume1 / newstool < prev    next >
Encoding:
Internet Message Format  |  1989-07-20  |  14.1 KB

  1. Path: uunet!wyse!vsi1!apple!rutgers!aramis.rutgers.edu!dartagnan.rutgers.edu!mcgrew
  2. From: mcgrew@dartagnan.rutgers.edu (Charles Mcgrew)
  3. Newsgroups: comp.sources.sun
  4. Subject: v01i054:  Newstool - use tooltool to read news using rn
  5. Message-ID: <Jul.20.17.50.16.1989.17244@dartagnan.rutgers.edu>
  6. Date: 20 Jul 89 21:50:19 GMT
  7. Organization: Rutgers Univ., New Brunswick, N.J.
  8. Lines: 435
  9. Approved: mcgrew@aramis.rutgers.edu
  10.  
  11. Submitted-by: bowen%prg.oxford.ac.uk@nfsnet-relay.ac.uk
  12. Posting-number: Volume 1, Issue 54
  13. Archive-name: newstool
  14.  
  15. [ My newsposter refused to take this file as-was: the <esc> character
  16.   and ^G character was included, and it doesn't like it.  I've
  17.   replaced the <esc> with "&" and the ^G with "~" - there are no other
  18.   &'s or ~'s in the file, so replace all "&" characters with escape
  19.   character and all "~" with control-g using your favorite editor
  20.   before unsharing.  If anyone wants the original file mailed to them,
  21.   send me mail.  - CWM]
  22.  
  23.  
  24.  
  25.               Copyright (C) 1989 University of Oxford
  26. Permission to copy without fee all or part of this material is granted
  27. provided that the copies are not made or distributed for direct
  28. commercial advantage, the University of Oxford copyright notice and the
  29. title and its date appear, and notice is given that copying is by
  30. permission of the University of Oxford or the original contributor.
  31.  
  32. #! /bin/sh
  33. # This is a shell archive, meaning:
  34. # 1. Remove everything above the #! /bin/sh line.
  35. # 2. Save the resulting text in a file.
  36. # 3. Execute the file with /bin/sh (not csh) to create the files:
  37. #    README
  38. #    Makefile
  39. #    newstool
  40. #    newstool.1
  41. #    newsreader
  42. #    news.icon
  43. #    nonews.icon
  44. # This archive created: Mon Apr 17 16:20:58 1989
  45. # By:    Jonathan "news" Bowen (Programming Research Group, Oxford University, UK)
  46. export PATH; PATH=/bin:$PATH
  47. echo shar: extracting "'README'" '(1403 characters)'
  48. if test -f 'README'
  49. then
  50.     echo shar: will not over-write existing file "'README'"
  51. else
  52. sed 's/^    X//' << \SHAR_EOF > 'README'
  53.     XThese files relate to the ``newstool'' command which
  54.     Xallows news to be read within a SunView window.
  55.     XThe software has only been tested on a Sun 3/50
  56.     Xusing the news reading program "rn".  The files include:
  57.     X
  58.     X    Makefile    - makefile to install files *
  59.     X    README        - this file *
  60.     X    news.icon    - icon displayed when new news is present
  61.     X    nonews.icon    - icon display when there is no new news
  62.     X    newsreader    - main news reading csh script *
  63.     X    newstool    - start-up shell script *
  64.     X    newstool.1    - manual page for tool *
  65.     X
  66.     X"newstool" is normally invoked by a user (e.g. in $HOME/.suntools
  67.     Xor $HOME/.rootmenu) and this in turn invokes "newsreader".
  68.     X
  69.     X* Note that some files are currently put under "/usr/news".
  70.     XThis may well need to be changed depending on the
  71.     Xlocal configuration. All the files except the icon files
  72.     Xshould be scanned for this string and edited appropriately
  73.     Xbefore the files are installed (by running "make").
  74.     X
  75.     X
  76.     XWritten by
  77.     X    Jonathan Bowen
  78.     X    Oxford University Computing Laboratory,
  79.     X    Programming Research Group,
  80.     X    8-11 Keble Road,
  81.     X    Oxford OX1 3QD,
  82.     X    England.
  83.     X    Tel: +44-865-272574 (Sec: +44-865-273840)
  84.     X
  85.     XCopyright (C) 1987,1988  by J.P.Bowen
  86.     X
  87.     XPermission is granted to copy these files for
  88.     Xnon-profit purposes, provided this notice is left intact.
  89.     X
  90.     XPlease send corrections, improvements, etc. to:
  91.     X    JANET: bowen@uk.ac.oxford.prg
  92.     X    ARPA:  bowen%prg.oxford.ac.uk@nsfnet-relay.ac.uk
  93.     X    UUCP:  ...!uunet!mcvax!ukc!ox-prg!bowen
  94.     X
  95. SHAR_EOF
  96. if test 1403 -ne "`wc -c < 'README'`"
  97. then
  98.     echo shar: error transmitting "'README'" '(should have been 1403 characters)'
  99. fi
  100. fi # end of overwriting check
  101. echo shar: extracting "'Makefile'" '(360 characters)'
  102. if test -f 'Makefile'
  103. then
  104.     echo shar: will not over-write existing file "'Makefile'"
  105. else
  106. sed 's/^    X//' << \SHAR_EOF > 'Makefile'
  107.     XROOT=/usr/news
  108.     XBIN=/usr/local/bin
  109.     XLIB=$(ROOT)/bin
  110.     XMAN=/usr/man/man1
  111.     XIMAGES=$(ROOT)/images
  112.     X
  113.     Xinstall:
  114.     X    chmod +x newstool newsreader
  115.     X    cp newstool $(BIN)
  116.     X    cp newsreader $(LIB)
  117.     X    cp newstool.1 $(MAN)
  118.     X    cp news.icon nonews.icon $(IMAGES)
  119.     X
  120.     Xshar:
  121.     X    shar -a README Makefile newstool newstool.1 \
  122.     X        newsreader news.icon nonews.icon > newstool.shar
  123.     X    compress newstool.shar
  124.     X
  125. SHAR_EOF
  126. if test 360 -ne "`wc -c < 'Makefile'`"
  127. then
  128.     echo shar: error transmitting "'Makefile'" '(should have been 360 characters)'
  129. fi
  130. fi # end of overwriting check
  131. echo shar: extracting "'newstool'" '(699 characters)'
  132. if test -f 'newstool'
  133. then
  134.     echo shar: will not over-write existing file "'newstool'"
  135. else
  136. sed 's/^    X//' << \SHAR_EOF > 'newstool'
  137.     X#!/bin/sh
  138.     X#
  139.     X#    newstool - window-based news reader
  140.     X#
  141.     X#    Written by Jonathan Bowen, October 1987
  142.     X#
  143.     X
  144.     XPATH=/bin:/usr/ucb:/usr/bin:/usr/local/bin
  145.     XWHO=news
  146.     XROOT=/usr/$WHO
  147.     XICONDIR=$ROOT/images
  148.     XPROGNAME=`basename $0`
  149.     XINTERVAL=300
  150.     X
  151.     Xcase "$1" in
  152.     X-i)
  153.     X    shift
  154.     X    case "$1" in
  155.     X    "")
  156.     X        echo "$PROGNAME: expected interval after -i"
  157.     X        exit 1
  158.     X        ;;
  159.     X    *)
  160.     X        INTERVAL=`expr X"$1" : X'\([0-9]*\)'`
  161.     X        if [ "$INTERVAL" = "" ]
  162.     X        then
  163.     X            echo "$PROGNAME: expected digits after -i"
  164.     X            exit 1
  165.     X        fi
  166.     X        shift
  167.     X        ;;
  168.     X    esac
  169.     X    ;;
  170.     X
  171.     X-u|-U)
  172.     X    echo "Usage: $PROGNAME [-i interval] [tool args]"
  173.     X    exit 0
  174.     X    ;;
  175.     X
  176.     Xesac
  177.     X
  178.     Xexport ROOT ICONDIR PROGNAME INTERVAL
  179.     X
  180.     Xexec shelltool -Wi -WI $ICONDIR/nonews.icon -Wl "$PROGNAME" -WL "" $* \
  181.     X        $ROOT/bin/newsreader
  182. SHAR_EOF
  183. if test 699 -ne "`wc -c < 'newstool'`"
  184. then
  185.     echo shar: error transmitting "'newstool'" '(should have been 699 characters)'
  186. fi
  187. chmod +x 'newstool'
  188. fi # end of overwriting check
  189. echo shar: extracting "'newstool.1'" '(1676 characters)'
  190. if test -f 'newstool.1'
  191. then
  192.     echo shar: will not over-write existing file "'newstool.1'"
  193. else
  194. sed 's/^    X//' << \SHAR_EOF > 'newstool.1'
  195.     X.TH NEWSTOOL 1L "9 October 1987" "" "LOCAL"
  196.     X.UC
  197.     X.SH NAME
  198.     Xnewstool \- window-based interface for news
  199.     X.SH SYNOPSIS
  200.     X.B newstool 
  201.     X[
  202.     X.B \-i
  203.     X.I seconds
  204.     X] 
  205.     X.SH DESCRIPTION
  206.     X.I Newstool
  207.     Xis a window-based interface to the \fIrn\fP(1) program for reading news
  208.     Xin the \fISunView\fP environment on a Sun workstation.  The icon
  209.     Xindicates whether there is any news to be read.  Additionally, the bell
  210.     Xis sounded when new news arrives, and \fIrn\fP is automatically
  211.     Xinvoked.  If there is no new news available, \fIrn\fP may still be
  212.     Xinvoked by opening the window and typing ^C to wake up the news
  213.     Xprogram.  The window is automatically closed on exit from \fIrn\fP.
  214.     X.SH OPTIONS
  215.     XThe following options are available:
  216.     X.TP 10
  217.     X.BI \-i " seconds"
  218.     XCheck for new news every \fIseconds\fP seconds.
  219.     XThe default is 300.
  220.     X.TP 10
  221.     X.B \-u
  222.     XDisplay the usage of the command.
  223.     X.PP
  224.     XSubsequently, standard \fIsuntools\fP(1) generic tool arguments may be
  225.     Xsupplied if desired.
  226.     X.PP
  227.     XThe default program used to read news is \fIrn\fP; however, this may be
  228.     Xchanged by setting the \fBNEWSPROG\fP environment variable to the
  229.     Xcommand to be executed when reading news.  For example, the line:
  230.     X.IP
  231.     Xsetenv NEWSPROG "vn \-%" 
  232.     X.LP
  233.     Xwould cause \fIvn\fP to be used with the \fI\-%\fP flag to read news. 
  234.     X.SH FILES
  235.     X.PD 0
  236.     X.TP 40
  237.     X/usr/news/bin/newsreader
  238.     Xmain \fIcsh\fP script
  239.     X.TP 40
  240.     X/usr/news/images/news.icon
  241.     Xnews available icon
  242.     X.TP 40
  243.     X/usr/news/images/nonews.icon
  244.     Xno news available icon
  245.     X.PD
  246.     X.SH "SEE ALSO"
  247.     Xnews(5),
  248.     Xsuntools(1),
  249.     Xrn(1),
  250.     Xrntool(1L),
  251.     Xvn(1)
  252.     X.SH AUTHOR
  253.     XJonathan Bowen, Oxford University.
  254.     X.SH BUGS
  255.     XThis shell script and manual page may change without notice.
  256.     X.PP
  257.     XPlease report problems to \fI<news@uk.ac.oxford.prg>\fP.
  258. SHAR_EOF
  259. if test 1676 -ne "`wc -c < 'newstool.1'`"
  260. then
  261.     echo shar: error transmitting "'newstool.1'" '(should have been 1676 characters)'
  262. fi
  263. fi # end of overwriting check
  264. echo shar: extracting "'newsreader'" '(1316 characters)'
  265. if test -f 'newsreader'
  266. then
  267.     echo shar: will not over-write existing file "'newsreader'"
  268. else
  269. sed 's/^    X//' << \SHAR_EOF > 'newsreader'
  270.     X#!/bin/csh -f
  271.     X#
  272.     X#    News reading program - check for news every 360 seconds,
  273.     X#        change icon etc when news is present/absent.
  274.     X#
  275.     X#    Normally invoked by "newstool".
  276.     X#
  277.     X#    Written by Jonathan Bowen, October 1987
  278.     X#    Based on a "newsread" shell script by Jeremy Jacob, 9 Oct 87
  279.     X#
  280.     X
  281.     X# set ROOT=/usr/news
  282.     X# set ICONDIR=$ROOT/images
  283.     X# set PROGNAME=newstool
  284.     X# set INTERVAL=360
  285.     Xif (${?NEWSPROG}) then
  286.     X  set NONEWS="No news (^C to read news)"
  287.     Xelse
  288.     X  set NONEWS="No news (^C to read old news)"
  289.     Xendif
  290.     X
  291.     Xonintr -
  292.     Xecho -n "&]L&\"
  293.     X
  294.     Xwhile (1)
  295.     X
  296.     X echo -n "&[2t"
  297.     X set NEWNEWS=`rn -c`
  298.     X
  299.     X if (! $#NEWNEWS) then
  300.     X  echo -n "&]I$ICONDIR/nonews.icon&\"
  301.     X  echo -n "&]l$PROGNAME - $NONEWS&\"
  302.     X
  303.     X# Check for new news
  304.     X  while (! $#NEWNEWS)
  305.     X   onintr read
  306.     X   sleep $INTERVAL
  307.     X   set NEWNEWS=`rn -c`
  308.     X   goto cont
  309.     X# Read news anyway
  310.     Xread:
  311.     X   onintr -
  312.     X   echo -n "&]l$PROGNAME - Reading news&\&[1t"
  313.     X   clear
  314.     X   if (${?NEWSPROG}) then
  315.     X    $NEWSPROG
  316.     X   else 
  317.     X    rn
  318.     X   endif
  319.     X   clear
  320.     X   echo -n "&[2t&]l$PROGNAME - $NONEWS&\"
  321.     Xcont:
  322.     X   onintr -
  323.     X  end
  324.     X
  325.     X# Sound bell twice
  326.     X  echo -n "~" ; sleep 1; echo -n "~"
  327.     X# Sound bell and make icon visible
  328.     X# (Not safe if screen is locked)
  329.     X# echo -n "~&[5t" ; echo -n "~"
  330.     X endif
  331.     X
  332.     X# Read new news
  333.     X echo -n "&]I$ICONDIR/news.icon&\"
  334.     X echo -n "&]l$PROGNAME - News&\"
  335.     X clear
  336.     X if (${?NEWSPROG}) then
  337.     X    $NEWSPROG
  338.     X else 
  339.     X    rn
  340.     X endif
  341.     X clear
  342.     X
  343.     Xend
  344. SHAR_EOF
  345. echo shar: 22 control characters may be missing from "'newsreader'"
  346. if test 1316 -ne "`wc -c < 'newsreader'`"
  347. then
  348.     echo shar: error transmitting "'newsreader'" '(should have been 1316 characters)'
  349. fi
  350. chmod +x 'newsreader'
  351. fi # end of overwriting check
  352. echo shar: extracting "'news.icon'" '(1933 characters)'
  353. if test -f 'news.icon'
  354. then
  355.     echo shar: will not over-write existing file "'news.icon'"
  356. else
  357. sed 's/^    X//' << \SHAR_EOF > 'news.icon'
  358.     X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  359.     X */
  360.     X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  361.     X    0x8000,0x0000,0x0000,0x0001,0x8003,0x9C00,0x0000,0x0001,
  362.     X    0x8001,0xC800,0x0000,0x0001,0x8001,0xC800,0x0000,0x0001,
  363.     X    0x8001,0x6870,0xC63E,0x0001,0x8001,0x68C8,0xC642,0x0001,
  364.     X    0x8001,0x398C,0xC660,0x0001,0x8001,0x39FC,0xD63C,0x0001,
  365.     X    0x8001,0x1980,0xD61E,0x0001,0x8001,0x1980,0xFE43,0x0001,
  366.     X    0x8001,0x08C4,0xEE61,0x0001,0x8003,0x8878,0xC65E,0x0001,
  367.     X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  368.     X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  369.     X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  370.     X    0xBFFF,0xFD75,0xD346,0x0001,0xA000,0x0524,0x9B49,0x24A1,
  371.     X    0xA010,0x0500,0x0045,0x24D1,0xA040,0x057E,0xAD42,0x2491,
  372.     X    0xA48F,0x7D00,0x0049,0x2C91,0xA8EC,0xE55B,0xEB46,0x1491,
  373.     X    0xAAEA,0xE500,0x0040,0x0001,0xA0AA,0xCD75,0xDF5B,0xE7FD,
  374.     X    0xA8A8,0x8500,0x0040,0x0001,0xAFFF,0xF55F,0xFB57,0x7F7D,
  375.     X    0xA935,0x0500,0x0040,0x0001,0xBFFF,0xFD7E,0x775D,0xFBFD,
  376.     X    0x8000,0x0100,0x0040,0x0001,0xA828,0x0175,0xBD5E,0xFEED,
  377.     X    0xBB3B,0x5500,0x0040,0x0001,0xAB2B,0x756F,0xFF5F,0xBFDD,
  378.     X    0x8000,0x0100,0x0040,0x0001,0xBEFD,0xFD7F,0xCF5D,0xFB7D,
  379.     X    0x8000,0x0100,0x0040,0x0001,0xB7F7,0xFD7B,0xBF57,0xDDDD,
  380.     X    0x8000,0x0100,0x0040,0x0001,0xBBDF,0xDD3E,0xFB5F,0xBDED,
  381.     X    0x8000,0x0100,0x0040,0x0001,0xBF7F,0x7D7F,0x675F,0xFFFD,
  382.     X    0x8000,0x0100,0x0050,0x0005,0xBEE9,0xFD7B,0x9F50,0x3E05,
  383.     X    0x8000,0x0100,0x0050,0x7F05,0xBBDF,0xBD6F,0xEF50,0xFF85,
  384.     X    0x8000,0x0100,0x0051,0xC1C5,0xBFEF,0xFD7E,0xFF51,0x8045,
  385.     X    0x800C,0x4D00,0x0053,0x2165,0xB6ED,0x057B,0xF352,0x52A5,
  386.     X    0x8009,0x6500,0x0052,0x2125,0xBFEA,0x657C,0xFF52,0x0C25,
  387.     X    0x8008,0x8500,0x0052,0x0025,0xBDCF,0x257B,0xBF51,0x3E45,
  388.     X    0x8008,0x0500,0x0050,0x9C85,0xB7EB,0xF57F,0xCF50,0x4105,
  389.     X    0x800A,0x7500,0x0050,0xBE85,0xA7AB,0xB57E,0xEF51,0x0045,
  390.     X    0x800A,0xDD00,0x0052,0x0025,0xBCEF,0xFD6F,0xDF5F,0xFFFD,
  391.     X    0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  392. SHAR_EOF
  393. if test 1933 -ne "`wc -c < 'news.icon'`"
  394. then
  395.     echo shar: error transmitting "'news.icon'" '(should have been 1933 characters)'
  396. fi
  397. fi # end of overwriting check
  398. echo shar: extracting "'nonews.icon'" '(1933 characters)'
  399. if test -f 'nonews.icon'
  400. then
  401.     echo shar: will not over-write existing file "'nonews.icon'"
  402. else
  403. sed 's/^    X//' << \SHAR_EOF > 'nonews.icon'
  404.     X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  405.     X */
  406.     X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  407.     X    0x8000,0x0000,0x0000,0x0001,0x8E70,0x0079,0xC000,0x0001,
  408.     X    0x8720,0x001C,0x8000,0x0001,0x8720,0x001C,0x8000,0x0001,
  409.     X    0x85A0,0xC016,0x870C,0x63E1,0x85A1,0x2016,0x8C8C,0x6421,
  410.     X    0x84E3,0x3013,0x98CC,0x6601,0x84E3,0x3013,0x9FCD,0x63C1,
  411.     X    0x8463,0x3011,0x980D,0x61E1,0x8463,0x3011,0x980F,0xE431,
  412.     X    0x8421,0x2010,0x8C4E,0xE611,0x8E20,0xC078,0x878C,0x65E1,
  413.     X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  414.     X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  415.     X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  416.     X    0xBFFF,0xFD75,0xD346,0x0001,0xA000,0x0524,0x9B49,0x24A1,
  417.     X    0xA000,0x0500,0x0045,0x24D1,0xA000,0x0500,0x0042,0x2491,
  418.     X    0xA000,0x0500,0x0049,0x2C91,0xA000,0x0500,0x0046,0x1491,
  419.     X    0xA000,0x0500,0x0040,0x0001,0xA000,0x0500,0x0040,0x0001,
  420.     X    0xA000,0x0500,0x0040,0x0001,0xA000,0x0500,0x0040,0x0001,
  421.     X    0xA000,0x0500,0x0040,0x0001,0xBFFF,0xFD00,0x0040,0x0001,
  422.     X    0x8000,0x0100,0x0040,0x0001,0xA828,0x0100,0x0040,0x0001,
  423.     X    0xBB3B,0x5500,0x0040,0x0001,0xAB2B,0x7500,0x0040,0x0001,
  424.     X    0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
  425.     X    0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
  426.     X    0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
  427.     X    0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x005F,0xFFFD,
  428.     X    0x8000,0x0100,0x0050,0x0005,0x8000,0x0100,0x0050,0x0005,
  429.     X    0x8000,0x0100,0x0050,0x0005,0x8000,0x0100,0x0050,0x0005,
  430.     X    0x8000,0x0100,0x0050,0x0005,0x800F,0xFD00,0x0050,0x0005,
  431.     X    0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
  432.     X    0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
  433.     X    0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
  434.     X    0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
  435.     X    0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
  436.     X    0x8008,0x0500,0x0050,0x0005,0x800F,0xFD00,0x005F,0xFFFD,
  437.     X    0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  438. SHAR_EOF
  439. if test 1933 -ne "`wc -c < 'nonews.icon'`"
  440. then
  441.     echo shar: error transmitting "'nonews.icon'" '(should have been 1933 characters)'
  442. fi
  443. fi # end of overwriting check
  444. #    End of shell archive
  445. exit 0
  446.